﻿@{
    ViewBag.Title = "领取维修标签";
}
<link href="../../Content/tableCss.css" rel="stylesheet" type="text/css" />
@using (Html.BeginForm("obuInfoControl", "UserReceiveObu", FormMethod.Post, new { ID = "tbForm" }))
{
<div style="text-align: center">
    <table width="800" id="tbForm">
        <tr>
            <td colspan="4" align="center">
                <span style="font-size: 16px; font-weight: bold">领取维修标签</span>
            </td>
        </tr>
        <tr>
            <td style="width: 200px; text-align: right">
                维修单号：
            </td>
            <td style="width: 200px; text-align: left">
                @Html.TextBox("txtOrderNo", "", new { @style = "width:230px;" })
            </td>
            <td style="width: 200px; text-align: right">
                标签号：
            </td>
            <td style="width: 200px; text-align: left">
                @Html.TextBox("txtObuNo", "", new { @style = "width:200px;", @MaxLength = "16" })
            </td>
        </tr>
        <tr>
            <td colspan="3">
            </td>
            <td>
                <input type="button" id="btnSelect" value="查 询" />
            </td>
        </tr>
        <tr>
            <td colspan="4">
            </td>
        </tr>
    </table>
</div>
}
@using (Html.BeginForm("updateOrdersInfo", "UserReceiveObu", FormMethod.Post, new { ID = "form_id" }))
{
    @Html.ValidationSummary(true)
        
    <div id="divObuContainer" style="display: none; text-align: center">
        <table>
            <tr>
                <td>
                    <!--动态加载标签基本信息的div容器-->
                    <div id="divObubaseInfoContainer">
                    </div>
                </td>
            </tr>
        </table>
    </div>
}
<script type="text/javascript">

    $(function () {
        $('#btnSelect').live("click", (function (e) {
           // debugger;
            var orderNo = $('#txtOrderNo').val();
            var obuNo = $('#txtObuNo').val();
            obuNo = $.trim(obuNo);
            orderNo = $.trim(orderNo);
            if (obuNo.StringIsNullOrEmpty() && orderNo.StringIsNullOrEmpty()) {
                alert("请输入维修单号或标签号！");
                $('#divObuContainer').hide();
            }
            else if (orderNo.StringIsNullOrEmpty() == false && orderNo.length != 24) {
                alert("请输入完整的24位维修单号！");
                $('#divObuContainer').hide();
            }
            else if (obuNo.StringIsNullOrEmpty() == false && obuNo.length != 16) {
                alert("请输入完整的16位标签号！");
                $('#divObuContainer').hide();
            }
            else {
                loadObuInfoControl(orderNo, obuNo);
            }
        }));
    });

    //动态加载基本信息的局部视图
    function loadObuInfoControl(id, obuNo) {
        //debugger;
        var d = new Date();
        var dateTimeNow = d.getTime();
        var url = '/UserReceiveObu/obuInfoControl/' + id + "," + obuNo + "," + dateTimeNow;
        $('#divObubaseInfoContainer').load(url, function (response, status) {
            $('#divObuContainer').show();
        });
    }
</script>
